package com.gobo.eduservice.controller;


import com.gobo.commonutils.R;
import com.gobo.eduservice.pojo.vo.OneSubjectVo;
import com.gobo.eduservice.service.EduSubjectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * <p>
 * 课程科目 前端控制器
 * </p>
 *
 * @author gobo-generator
 * @since 2021-09-19
 */
@RestController
@RequestMapping("/eduservice/subject")
public class EduSubjectController {

    @Autowired
    private EduSubjectService subjectService;

    @PostMapping("/upload/save")
    public R uploadSubject(MultipartFile file){
        subjectService.saveUpload(file,subjectService);
        return R.ok();
    }
    @GetMapping("/getAll")
    public R getAllSubject(){
        List<OneSubjectVo> list =  subjectService.getAllSubject();
        return R.ok().data("items",list);
    }


}

